< previous page page_20 next page >

Page 20
The EllipseWithSegments and ScaledCircle subroutines both take X and Y coordinate values that bound the ellipse as parameters. This is much easier to understand than the center, radius, and aspect ratio values required by the Circle method.
The sines and cosines used by subroutine EllipseWithSegments are a bit easier to understand than the seemingly arbitrary way in which ScaledCircle sets its radius. Depending on the number of segments EllipseWithSegments draws, however, ScaledCircle may be faster and produce a smoother result.
Example program Ellipses, shown in Figure 1.10, demonstrates the EllipseWithSegments and ScaledCircle subroutines.
The problem with the Circle method is that it has been asked to do too many things at once. Because it can draw circles, ellipses, arcs, and pie slices, it is quite confusing to use in all but the simplest cases.
PaintPicture Method
The PaintPicture method copies images from a form or picture box onto a form, picture box, or printer. PaintPicture has this syntax:
PaintPicture source, dx, dy, dwidth, dheight, sx, sy, swidth, sheight,
opcode
source
The Picture or Image property of the source form or picture box.
dx, dy
The destination X and Y coordinates.
dwidth, dheight
The width and height of the destination area. If the source and destination are different sizes, the image is stretched or shrunk to fit.
sx, sy
The source X and Y coordinates.
swidth, sheight
The width and height of the part of the source image to copy.
opcode
The method by which the source is copied.

The source parameter must specify a valid image. If you load a form or picture box with a bitmap or other graphic file, that control's Picture property holds a valid image. If you set a
0020-01.jpg
Figure 1.10
Example program Ellipses compares the Circle method with
the EllipseWithSegments and ScaledCircle subroutines.

 
< previous page page_20 next page >